#define _CRT_SECURE_NO_WARNINGS 1
#include "Heap.h"

void HeapTest()
{
	Heap hp;
	hp.Push(6);
	hp.Push(5);
	hp.Push(4);
	hp.Push(3);
	hp.Push(2);
	hp.Push(1);
	hp.Pop();
	cout << hp.Top() << endl;
	cout << hp.Empty() << endl;
}

void HeapSort(int* arr, int size)
{
	Heap hp(size);
	for (int i = 0; i < size; i++)
	{
		hp.Push(*(arr+i));
	}


	for (int i = 0; i < size; i++)
	{
		*(arr + i) = hp.Top();
		hp.Pop();
	}
}
void PrintArr(int* arr, int size)
{
	for (int i = 0; i < size; i++)
	{
		cout << *(arr + i) << " ";
	}
	cout << endl;
}
int main()
{
	int arr[] = { 5,2,8,6,4,112,9,7,3 };
	int sz = sizeof(arr) / sizeof(arr[0]);
	HeapSort(arr, sz);
	PrintArr(arr, sz);
	return 0;
}

